<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
        
        <script src="/ukkepuk/source/html/scripts/jquery-1.7.1.js"></script>
        <script src="/ukkepuk/source/html/scripts/topmenu.js"></script>
        <script>
        function readKidsCommingInWeek(datekey) {

            $.ajax({
                url: 'calendar_actions.php',
                type: "POST",
                data: {datekey: datekey, action: "kidsCommingInWeek"},
                dataType: "xml",
                success: function(data) {
                    $(".kidsweek tr").remove();
                    $(".actions #prevweek").remove();
                    $(".actions #nextweek").remove();
                    
                    prev = $(data).find("kidsInWeek").attr("prev");
                    next = $(data).find("kidsInWeek").attr("next");
                    day = $(data).find("kidsInWeek").attr("day");
                    monthlabel = $(data).find("kidsInWeek").attr("monthlabel");
                    
                    title = "Week van maandag " + day + " " + monthlabel ;
                    $(".monthlabel").text(title);
                    
                 $("<img src=\"/ukkepuk/webcontent/images/right.png\" id=\"nextweek\" alt=\"print\" onclick=\"readKidsCommingInWeek('"+next+"')\"/>").insertBefore("#printbtn");
                 $("<img src=\"/ukkepuk/webcontent/images/left.png\" id=\"prevweek\" alt=\"print\" onclick=\"readKidsCommingInWeek('"+prev+"')\"/>").insertBefore("#printbtn");
                    
                    firstrow = true;
                    $(data).find("kid").each( function() {
                        headrow = "<tr><th>Naam</th>";
                        kidrow = "<tr><td class=\"name\">" + $(this).attr("name") + "</td>"; 
                        
                        $(this).find("date").each( function() {
                            if(firstrow)
                               headrow += "<th>"+$(this).attr("day")+"</th>";
                           
                            if($(this).attr("in") == "Y")
                                kidrow += "<td class=\"in\">van: <br/> tot: </td>";
                            else
                                kidrow += "<td> </td>";
                        });
                        
                        if(firstrow){
                            firstrow = false;
                            $(headrow).appendTo(".kidsweek");
                        }
                        
                        
                        kidrow += "</tr>";
                        
                        $(kidrow).appendTo(".kidsweek");
                    });
                }
            });
        }
        </script>
        
        
        <style type="text/css" media="all">
            @import url("/ukkepuk/source/html/css/ukkepukmain.css");
            @import url("/ukkepuk/source/html/css/topmenu.css");
            @import url("/ukkepuk/source/html/css/kidsthumb.css");
        </style>
        <style type="text/css" media="print">
            @import url("/ukkepuk/source/html/css/print.css");
            
        </style>
    </head>
    <body>
        <div id="main">
            <?php require_once($_SERVER['DOCUMENT_ROOT'] . '/ukkepuk/source/php/panels/topmenu.php'); ?>
            <div id="content">
                <?php include($_SERVER['DOCUMENT_ROOT'] . '/ukkepuk/source/php/panels/AdminKidAttendance.php'); ?>        
                
            </div>        
        </div>
    </body>
</html>
